<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<f:view>

	<f:metadata>
		<f:viewAction action="#{menuMB.updateMenu(11)}" />
		<f:viewParam name="idcaja" value="#{openCloseCajaBean.idcaja}" />
		<f:viewAction action="#{openCloseCajaBean.loadCajaForClose()}" />
	</f:metadata>
	<ui:composition template="/WEB-INF/templates/defaultLayout.xhtml">
		<!-- Definiendo la cabecera de la pagina -->
		<ui:define name="title">
			<h:outputText value="Close Caja" />
		</ui:define>
		<!-- Definiendo el cuerpo de la pagina -->
		<ui:define name="content">	
			<h:outputStylesheet library="css" name="main.css" />
			<br />

			<h:form id="formClose">

				<h:panelGroup rendered="#{openCloseCajaBean.successCloseCaja}">
					<div class="p6n-butterbar" style="left: 516px;">
						<div>
							<div>
								<p>
									<h:messages />
								</p>
							</div>
							<div style="text-align: center;">
								<h:commandLink value="Aceptar"
									action="/jefeCaja/caja/administracion/list?faces-redirect=true"
									styleClass="p6n-api-access-in-page-error-link" />
							</div>
						</div>
					</div>
					<div class="modal-dialog-bg"
						style="opacity: 0.4; width: 1366px; height: 1000px;"
						aria-hidden="true"></div>
				</h:panelGroup>

				<h:panelGroup rendered="#{!openCloseCajaBean.validBean}">
					<div class="p6n-api-access-in-page-error" style="left: 516px;">
						<div>
							<div>
								<p>
									<h:messages />
								</p>
							</div>
							<div style="text-align: center;">
								<h:commandLink value="Cerrar" action="cancel"
									styleClass="p6n-api-access-in-page-error-link" />
							</div>
						</div>
					</div>
					<div class="modal-dialog-bg"
						style="opacity: 0.4; width: 1366px; height: 2000px;"
						aria-hidden="true"></div>
				</h:panelGroup>

				<h:panelGroup rendered="#{openCloseCajaBean.successPendiente}">
					<div class="p6n-butterbar" id="p6n-manualbutterbar0"
						style="left: 41%;">
						<div>
							<h:messages />
						</div>
						<div style="text-align: center;">
							<h:commandLink value="Salir" action="cancel"
								styleClass="p6n-api-access-in-page-error-link" />
						</div>
					</div>
					<div class="modal-dialog-bg"
						style="opacity: 0.4; width: 1366px; height: 2000px;"
						aria-hidden="true"></div>
				</h:panelGroup>

				<h:panelGroup rendered="#{!openCloseCajaBean.validSaldoCajaSoles}">
					<h:panelGroup rendered="#{!openCloseCajaBean.pendiente}">
					<div class="p6n-api-access-in-page-error" style="left: 516px;">
						<div>
							<div>
								<p>
									<h:messages />
								</p>
							</div>
							<div style="text-align: center;">
								<h:commandLink value="Cerrar" action="cancel"
									styleClass="p6n-api-access-in-page-error-link"/>
								&nbsp;|&nbsp;
								<h:commandLink value="Crear Pendiente" action="#{openCloseCajaBean.setPendiente()}"
									styleClass="p6n-api-access-in-page-error-link" />
							</div>
						</div>
					</div>
					<div class="modal-dialog-bg"
						style="opacity: 0.4; width: 1366px; height: 2000px;"
						aria-hidden="true"></div>
					</h:panelGroup>
				</h:panelGroup>

				<h:panelGroup rendered="#{!openCloseCajaBean.validSaldoCajaDolares}">
					<h:panelGroup rendered="#{!openCloseCajaBean.pendiente}">
						<div class="p6n-api-access-in-page-error" style="left: 516px;">
							<div>
								<div>
									<p>
										<h:messages />
									</p>
								</div>
								<div style="text-align: center;">
									<h:commandLink value="Cerrar" action="cancel"
										styleClass="p6n-api-access-in-page-error-link" />
									&nbsp;|&nbsp;
									<h:commandLink value="Crear Pendiente"
										action="#{openCloseCajaBean.setPendiente()}"
										styleClass="p6n-api-access-in-page-error-link" />
								</div>
							</div>
						</div>
						<div class="modal-dialog-bg"
							style="opacity: 0.4; width: 1366px; height: 2000px;"
							aria-hidden="true"></div>
					</h:panelGroup>
				</h:panelGroup>

				<h:panelGroup rendered="#{!openCloseCajaBean.validSaldoCajaEuros}">
					<h:panelGroup rendered="#{!openCloseCajaBean.pendiente}">
						<div class="p6n-api-access-in-page-error" style="left: 516px;">
							<div>
								<div>
									<p>
										<h:messages />
									</p>
								</div>
								<div style="text-align: center;">
									<h:commandLink value="Cerrar" action="cancel"
										styleClass="p6n-api-access-in-page-error-link" />
									&nbsp;|&nbsp;
									<h:commandLink value="Crear Pendiente"
										action="#{openCloseCajaBean.setPendiente()}"
										styleClass="p6n-api-access-in-page-error-link" />

								</div>
							</div>
						</div>
						<div class="modal-dialog-bg"
							style="opacity: 0.4; width: 1366px; height: 2000px;"
							aria-hidden="true"></div>
					</h:panelGroup>
				</h:panelGroup>

				<h:panelGroup rendered="#{openCloseCajaBean.pendiente}">
					<div style="margin-left: 50px;">
						<div>
							<div>
								<div class="p6n-api-consent-screen-title">Pendiente Caja</div>

								<div class="p6n-api-consent-screen-inputs">
									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label"
											style="width: 150px;">AGENCIA</div>
										<div style="font-weight: bold; font-size: 12px;">
											<h:outputLabel value="#{cajaCRUDBean.agencia.denominacion}" />
										</div>
									</div>

									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label"
											style="width: 150px;">Tipo Pendiente</div>
										<div style="font-weight: bold; font-size: 12px;">
											<h:outputText value="#{openCloseCajaBean.pendientecaja.tipopendiente}" />
										</div>
									</div>

									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label">Tipo Moneda</div>
										<div>
											<div style="font-weight: bold; font-size: 12px;">
												<h:outputText
													value="#{openCloseCajaBean.pendientecaja.tipomoneda.denominacion} (#{openCloseCajaBean.pendientecaja.tipomoneda.abreviatura})" />
											</div>
										</div>
									</div>

									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label">Monto</div>
										<div>
											<div style="font-weight: bold; font-size: 12px;">
												<h:outputText value="#{openCloseCajaBean.pendientecaja.tipomoneda.abreviatura} #{openCloseCajaBean.pendientecaja.monto.value}" />
											</div>
										</div>
									</div>

									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label">Observación</div>
										<div>
											<div>
												<p:inputTextarea rows="10" cols="60" queryDelay="750"
													onkeyup="this.value = this.value.toUpperCase();"
													minQueryLength="4" maxlength="300" value="#{openCloseCajaBean.pendientecaja.observacion}"/>
											</div>
										</div>
									</div>

									<div class="sf-buttons" style="float: left;">
										<h:commandButton action="#{openCloseCajaBean.crearPendiente()}"
											value="Guardar" styleClass="action blue"
											onclick="onSubmitButton();" />
										<h:commandButton value="Cancelar"
											action="/modules/caja/administracion/list?faces-redirect=true"
											immediate="true" styleClass="action" />

									</div>
								</div>
							</div>
						</div>
					</div>
				</h:panelGroup>

				<h:panelGroup rendered="#{!openCloseCajaBean.pendiente}">
					<div style="margin-left: 50px;">
						<div>
							<div>
								<div class="p6n-api-consent-screen-title">Cerrar Caja</div>

								<div class="p6n-api-consent-screen-inputs">
									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label"
											style="width: 150px;">AGENCIA</div>
										<div>
											<h:outputLabel
												value="#{openCloseCajaBean.agencia.denominacion}" />
										</div>
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label"
												style="width: 150px;">CAJA</div>
											<div>
												<div>
													<h:outputLabel
														value="#{openCloseCajaBean.caja.denominacion}" />
												</div>
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label"
												style="width: 150px;">ABREVIATURA</div>
											<div>
												<h:outputLabel value="#{openCloseCajaBean.caja.abreviatura}" />
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label"
												style="width: 150px;">ESTADO</div>
											<div>
												<h:outputLabel
													value="#{openCloseCajaBean.caja.estadoapertura.denominacion}" />
											</div>
										</div>
									</div>
									<br />
									<div>
										<p:accordionPanel multiple="true">
											<p:tab title="MONEDA NUEVO SOL"
												rendered="#{openCloseCajaBean.caja_Boveda_Nuevo_Sol()}">
												<p:panelGrid columns="2" style="margin-left:1px;">
													<p:outputPanel>
														<p:dataTable var="cajaDetalleSolesLastNoActive"
															value="#{openCloseCajaBean.tablaCajaDetalleSolesLastNoActive.rows}"
															rowKey="#{cajaDetalleSolesLastNoActive}"
															rowIndexVar="row">

															<f:facet name="header">SALDO INICIAL</f:facet>

															<p:column headerText="Nro" width="15"
																style="text-align:center;">
																<h:outputText value="#{row + 1}" />
															</p:column>
															<p:column headerText="Denominacion" width="40"
																style="text-align:right">
																<h:outputText
																	value="#{cajaDetalleSolesLastNoActive.denominacionmoneda.denominacion}" />
															</p:column>
															<p:column headerText="Cantidad" width="100"
																style="text-align:right; height:19px">
																<h:outputText
																	value="#{cajaDetalleSolesLastNoActive.cantidad}" />
															</p:column>
															<p:column headerText="Total" width="150"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleSolesLastNoActive.subtotal}" />
															</p:column>

															<p:columnGroup type="footer">
																<p:row>
																	<p:column colspan="3" footerText="Total en Caja:"
																		style="text-align:right" />
																	<p:column colspan="1"
																		footerText="#{openCloseCajaBean.totalHistorialcajaSolesLastNoActive}"
																		style="text-align:right" />
																</p:row>
															</p:columnGroup>
														</p:dataTable>
													</p:outputPanel>

													<p:outputPanel>
														<p:dataTable var="cajaDetalleSoles" id="tableTotalSoles"
															value="#{openCloseCajaBean.tablaCajaDetalleSoles.rows}"
															rowKey="#{cajaDetalleSoles}" rowIndexVar="row">

															<f:facet name="header">SALDO FINAL</f:facet>

															<p:column headerText="Nro" width="15"
																style="text-align:center;">
																<h:outputText value="#{row + 1}" />
															</p:column>
															<p:column headerText="Denominacion" width="40"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleSoles.denominacionmoneda.denominacion}" />
															</p:column>
															<p:column headerText="Cantidad" width="100"
																style="text-align:right;">
																<h:inputText value="#{cajaDetalleSoles.cantidad}"
																	id="aaaa" required="true" maxlength="6"
																	styleClass="jfk-textinput p6n-api-consent-screen-homepage-url label-input-label"
																	style="text-align:left; width:100px; height:20px">
																	<f:ajax event="blur" execute="@this"
																		render="totalSoles tableTotalSoles" />
																</h:inputText>
															</p:column>
															<p:column headerText="Total" width="150"
																style="text-align:right;">
																<h:outputText id="txtTotalSoles"
																	value="#{cajaDetalleSoles.subtotal}">
																</h:outputText>
															</p:column>

															<p:columnGroup id="totalSoles" type="footer">
																<p:row>
																	<p:column colspan="3" footerText="Total en Caja:"
																		style="text-align:right" />
																	<p:column colspan="1"
																		footerText="#{openCloseCajaBean.totalHistorialCajaSoles()}"
																		style="text-align:right" />
																</p:row>
															</p:columnGroup>

														</p:dataTable>
													</p:outputPanel>
												</p:panelGrid>
											</p:tab>

											<p:tab title="MONEDA DOLARES"
												rendered="#{openCloseCajaBean.caja_Boveda_Dolar()}">
												<p:panelGrid columns="2" style="margin-left:1px;">
													<p:outputPanel>
														<p:dataTable var="cajaDetalleDolaresLastNoActive"
															value="#{openCloseCajaBean.tablaCajaDetalleDolaresLastNoActive.rows}"
															rowKey="#{cajaDetalleDolaresLastNoActive}"
															rowIndexVar="row">

															<f:facet name="header">SALDO INICIAL</f:facet>

															<p:column headerText="Nro" width="15"
																style="text-align:center;">
																<h:outputText value="#{row + 1}" />
															</p:column>
															<p:column headerText="Denominacion" width="40"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleDolaresLastNoActive.denominacionmoneda.denominacion}" />
															</p:column>
															<p:column headerText="Cantidad" width="100"
																style="text-align:right; height:19px">
																<h:outputText
																	value="#{cajaDetalleDolaresLastNoActive.cantidad}" />
															</p:column>
															<p:column headerText="Total" width="150"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleDolaresLastNoActive.subtotal}" />
															</p:column>

															<p:columnGroup type="footer">
																<p:row>
																	<p:column colspan="3" footerText="Total en Caja:"
																		style="text-align:right" />
																	<p:column colspan="1"
																		footerText="#{openCloseCajaBean.totalHistorialcajaDolaresLastNoActive}"
																		style="text-align:right" />
																</p:row>
															</p:columnGroup>
														</p:dataTable>
													</p:outputPanel>

													<p:outputPanel>
														<p:dataTable var="cajaDetalleDolares"
															id="tableTotalDolares"
															value="#{openCloseCajaBean.tablaCajaDetalleDolares.rows}"
															rowKey="#{cajaDetalleDolares}" rowIndexVar="row">

															<f:facet name="header">SALDO FINAL</f:facet>

															<p:column headerText="Nro" width="15"
																style="text-align:center;">
																<h:outputText value="#{row + 1}" />
															</p:column>
															<p:column headerText="Denominacion" width="40"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleDolares.denominacionmoneda.denominacion}" />
															</p:column>
															<p:column headerText="Cantidad" width="100"
																style="text-align:right;">

																<h:inputText value="#{cajaDetalleDolares.cantidad}"
																	required="true" maxlength="6"
																	styleClass="jfk-textinput p6n-api-consent-screen-homepage-url label-input-label"
																	style="text-align:left; width:100px; height:20px">
																	<f:ajax event="blur" execute="@this"
																		render="txtTotalDolares tableTotalDolares" />
																</h:inputText>

															</p:column>
															<p:column headerText="Total" width="150"
																style="text-align:right;">
																<h:outputText id="txtTotalDolares"
																	value="#{cajaDetalleDolares.subtotal}" />
															</p:column>

															<p:columnGroup id="panelTotalTransaccionDolares"
																type="footer">
																<p:row>
																	<p:column colspan="3" footerText="Total en Caja:"
																		style="text-align:right" />
																	<p:column colspan="1"
																		footerText="#{openCloseCajaBean.totalHistorialCajaDolares()}"
																		style="text-align:right" />
																</p:row>
															</p:columnGroup>
														</p:dataTable>
													</p:outputPanel>
												</p:panelGrid>
											</p:tab>

											<p:tab title="MONEDA EUROS"
												rendered="#{openCloseCajaBean.caja_Boveda_Euro()}">
												<p:panelGrid columns="2" style="margin-left:1px;">
													<p:outputPanel>
														<p:dataTable var="cajaDetalleEurosLastNoActive"
															value="#{openCloseCajaBean.tablaCajaDetalleEurosLastNoActive.rows}"
															rowKey="#{cajaDetalleEurosLastNoActive}"
															rowIndexVar="row">

															<f:facet name="header">SALDO INICIAL</f:facet>

															<p:column headerText="Nro" width="15"
																style="text-align:center;">
																<h:outputText value="#{row + 1}" />
															</p:column>
															<p:column headerText="Denominacion" width="40"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleEurosLastNoActive.denominacionmoneda.denominacion}" />
															</p:column>
															<p:column headerText="Cantidad" width="100"
																style="text-align:right; height:19px;">
																<h:outputText
																	value="#{cajaDetalleEurosLastNoActive.cantidad}" />
															</p:column>
															<p:column headerText="Total" width="150"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleEurosLastNoActive.subtotal}" />
															</p:column>

															<p:columnGroup type="footer">
																<p:row>
																	<p:column colspan="3" footerText="Total en Caja:"
																		style="text-align:right" />
																	<p:column colspan="1"
																		footerText="#{openCloseCajaBean.totalHistorialcajaEurosLastNoActive}"
																		style="text-align:right" />
																</p:row>
															</p:columnGroup>
														</p:dataTable>
													</p:outputPanel>

													<p:outputPanel>
														<p:dataTable var="cajaDetalleEuros" id="tableTotalEuros"
															value="#{openCloseCajaBean.tablaCajaDetalleEuros.rows}"
															rowKey="#{cajaDetalleEuros}" rowIndexVar="row">

															<f:facet name="header">SALDO FINAL</f:facet>

															<p:column headerText="Nro" width="15"
																style="text-align:center;">
																<h:outputText value="#{row + 1}" />
															</p:column>
															<p:column headerText="Denominacion" width="40"
																style="text-align:right;">
																<h:outputText
																	value="#{cajaDetalleEuros.denominacionmoneda.denominacion}" />
															</p:column>
															<p:column headerText="Cantidad" width="100"
																style="text-align:right;">

																<h:inputText value="#{cajaDetalleEuros.cantidad}"
																	required="true" maxlength="6"
																	styleClass="jfk-textinput p6n-api-consent-screen-homepage-url label-input-label"
																	style="text-align:left; width:100px; height:20px">
																	<f:ajax event="blur" execute="@this"
																		render="txtTotalEuros tableTotalEuros" />
																</h:inputText>
															</p:column>
															<p:column headerText="Total" width="150"
																style="text-align:right;">
																<h:outputText id="txtTotalEuros"
																	value="#{cajaDetalleEuros.subtotal}" />
															</p:column>

															<p:columnGroup id="panelTotalTransaccionEuros"
																type="footer">
																<p:row>
																	<p:column colspan="3" footerText="Total en Caja:"
																		style="text-align:right" />
																	<p:column colspan="1"
																		footerText="#{openCloseCajaBean.totalHistorialCajaEuros()}"
																		style="text-align:right" />
																</p:row>
															</p:columnGroup>
														</p:dataTable>
													</p:outputPanel>
												</p:panelGrid>
											</p:tab>
										</p:accordionPanel>
									</div>

									<div class="sf-buttons" style="float: left;">
										<h:commandButton action="#{openCloseCajaBean.closeCaja()}"
											value="Cerrar" styleClass="action blue" />

										<h:commandButton action="/jefeCaja/caja/administracion/list?faces-redirect=true" value="Cancelar"
											styleClass="action" />
									</div>
								</div>
							</div>
						</div>
					</div>
				</h:panelGroup>
			</h:form>
		</ui:define>
	</ui:composition>
</f:view>
</html>








